/*
 * =====================================================================================
 *
 *       Filename:  singleton.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/16/2011 02:03:05 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  dp (8023), dp8023@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */

#include "singleton.h"

#include <iostream>

using namespace std;

singleton *singleton::get_inst = NULL;

singleton *singleton::instance()
{
	if (NULL == get_inst)
	{
		get_inst = new singleton();
		static cleaner cl;
	}

	return get_inst;
}

void singleton::print(const string &str)
{
	cout << "singleton print " << str << endl;
}

singleton::cleaner::~cleaner()
{
	if (singleton::instance())
		delete singleton::instance();
}

